import {UserLottery} from "../../model/travels"

Component({
    properties: {
        startMaskShow: Boolean,
    },
    data: {
        number: 0
    },
    methods: {
        onKnow() {
            this.triggerEvent("closeMask")
        },
        onLotteryTap() {
            let timeRun = 0
            let that = this
            let myTime=setInterval(function(){
                that.setData({
                    number: Math.floor(Math.random() * 10) + 10
                })
                timeRun+=1;
                if(timeRun === 20){
                    clearInterval(myTime)
                    UserLottery().then(res => {
                        that.setData({
                            number: res.count
                        })
                        that.triggerEvent("lottery")
                    })
                }
            },100)
        }
    }
});
